﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace PlaneGame
{
    /// <summary>
    /// 玩家飞机的对象
    /// </summary>
    public class Hero:GameObject
    {
       
       

        public Hero(int x,int y):base(x,y,Properties.Resources.hero1)
        {
            DataUtil.IsTowBullet = false;      //默认情况下，它不是双排子弹 
            DataUtil.IsSuperBullet = false;     //默认情况下，它不是超级子弹

            this.Width = this.img.Width / 2;
            this.Height = this.img.Height / 2;
        }


        /// <summary>
        /// 玩家飞机发射子弹的方式
        /// </summary>
        public void Fire()
        {
            if (DataUtil.IsTowBullet)
            {
               
            }
            else if (DataUtil.IsSuperBullet)
            {
                //Bullet b = new Bullet(this.X, this.Y);
                //b.X = b.X - 20 + this.Width / 2 - b.Width / 2 ;
                //b.img = Properties.Resources.bullet3;
                //b.Height = this.Height;
                //b.Width =  this.Width + 20;
                //DataUtil.bulletList.Add(b);
            }
            else if (DataUtil.IsManyBullet)
            {
                DataUtil.bulletList.Add(new Bullet(this.X + 17, this.Y - 10, 0));
                DataUtil.bulletList.Add(new Bullet(this.X + 27, this.Y - 18, 60));
                DataUtil.bulletList.Add(new Bullet(this.X + 37, this.Y - 18, 30));
                DataUtil.bulletList.Add(new Bullet(this.X + 7, this.Y - 12, 120));
                DataUtil.bulletList.Add(new Bullet(this.X , this.Y - 7, 150));
            }
            else
            {
                //说明要发双排子弹
                Bullet b_left = new Bullet(this.X, this.Y, 0);
                Bullet b_right = new Bullet(this.X, this.Y, 0);
                //修正左边子弹的位置
                b_left.X = b_left.X + this.Width / 4 - b_left.Width / 2;
                //修正右边子弹的位置
                b_right.X = b_right.X + this.Width / 4 * 3 - b_right.Width / 2;

                DataUtil.bulletList.Add(b_left);
                DataUtil.bulletList.Add(b_right);
            }
        

        }
    }
}
